<template>
  <div class="page-containers">
    <div class="userPart">

      <div class="part" v-for="(item, index) in partArray" :key="index" :class="{'girlPart':item.sexFlag==1,'boyPart':item.sexFlag==2,'noPart':!item.memberOneResponseList.length}">
        <h1>{{item.deptName}}</h1>
        <div class="flex item" v-if="item.memberOneResponseList&&item.memberOneResponseList.length">
          <div class="inner">
            <div class="info" :class="['info'+(index1+1)]" v-for="(item1, index1) in item.memberOneResponseList" :key="index1">
              <h2>{{ item1.labelName }}</h2>
              <div class="desc" :class="[item1.labelMemberTwoResponseList&&item1.labelMemberTwoResponseList.length > 9&&W>1900 ? 'big' : ''
              ]">
                <p v-for="(item2, index2) in item1.labelMemberTwoResponseList" :key="index2">
                  {{ item2.labelName }}
                  <template v-for="(item3, index3) in item2.tLabelMemberThreeResponseList">
                    <span :key="index3">/&nbsp;{{ item3.labelName }}</span>
                  </template>
                </p>
              </div>
            </div>
          </div>
        </div>
        <template v-else>
          <h3 class="noData">暂无数据</h3>
          <div class="flex item">
            <div class="inner">
              <div class="info info1">
                <h2>基础信息</h2>
              </div>
              <div class="info info2">
                <h2>用户行为</h2>
              </div>
              <div class="info info3">
                <h2>消费偏好</h2>
              </div>
              <div class="info info4">
                <h2>风控预警</h2>
              </div>
              <div class="info info5">
                <h2>交易行为</h2>
              </div>
              <div class="info info6">
                <h2>自定义标签</h2>
              </div>
            </div>
          </div>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      W: window.innerWidth,
      thirdUserId: this.$route.params.thirdUserId,
      deptIds: [],
      deptOptions: [],

      checkedCities: [],
      list: [],
      partArray: [],
      checkAll: false,
      isIndeterminate: true
    };
  },
  methods: {

    init: function() {
      let params = {
        thirdUserId: this.thirdUserId
      };

      this.utils.request.queryLabelByThirdUserId(params, res => {
        if (res.code == '0000') {
          this.list = res.data;
          this.checkedCities = res.data;
          this.partArray = res.data;

          this.partArray.forEach(f => {
            if (f.memberOneResponseList) {
              f.memberOneResponseList.forEach(f1 => {
                if (f1.labelMemberTwoResponseList) {
                  f1.labelMemberTwoResponseList.forEach(f2 => {
                    if (f2.tLabelMemberThreeResponseList) {
                      f2.tLabelMemberThreeResponseList.forEach(f3 => {
                        if (f3.labelName == '女') {
                          f.sexFlag = 1;
                        }else if (f3.labelName == '男') {
                          f.sexFlag = 2;
                        }  else {
                          f.sexFlag = 3;
                        }
                      });
                    }
                  });
                }
              });
            }
          });
          console.log(this.partArray)
        }
      });
    },
    handleCheckedCitiesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.list.length;
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.list.length;

      this.partArray = value;
    }
  },
  mounted() {
    this.init();
  }
};
</script>

<style lang="scss" scoped>
.userPart {
  /deep/ .el-checkbox {
    margin: 0 10px 10px 0 !important;
  }
  .userPartItem {
    justify-content: flex-start;
    align-items: flex-start;
    /deep/ .el-checkbox-group {
      width: 90%;
    }
  }
  .part {
    position: relative;
    width: calc(100% - 10px);
    min-height: 840px;
    margin: 30px auto 0;
    border: 4px solid #edf4f9;
    border-radius: 36px;
    margin-bottom: 50px;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
    background: url('http://mss.cosmoplat.com/yxzx-public-test/d1d3fed639eb40049eee38fa3b205043.png') no-repeat center center #edf4f9;
    background-size: 418px 418px;
    &:hover {
      border-color: #00abf5;
    }
    &.boyPart {
      background: url('http://mss.cosmoplat.com/yxzx-public-test/3d706cbef366415498cf749deeb44e9b.png') no-repeat center center #edf4f9;
    }
    &.girlPart {
      background: url('http://mss.cosmoplat.com/yxzx-public-test/c35eea272d4b478ba9235d7f32f64440.png') no-repeat center center #f7f0ee;
      &:hover {
        border-color: #d8705c;
      }
      .item {
        .inner {
          h2 {
            background: #d8705c;
          }
        }
      }
      p {
        &::after {
          background: #d8705c;
        }
      }
      .desc {
        /*定义滚动条轨道 内阴影+圆角*/
        &::-webkit-scrollbar-track {
          background-color: #ede2e1;
        }

        /*定义滑块 内阴影+圆角*/
        &::-webkit-scrollbar-thumb {
          background-color: #e5c4be;
        }
      }
    }
    &.noPart {
      background: url('http://mss.cosmoplat.com/yxzx-public-test/e25d7ffcaa544eaca1628b02ba196e57.png') no-repeat center center #f7f7f7;
      &:hover {
        border-color: #cbcbcb;
      }

      .item {
        .inner {
          h2 {
            background: #cbcbcb;
          }
        }
      }

      p {
        &::after {
          background: #cbcbcb;
        }
      }
    }
    .noData {
      font-size: 16px;
      color: #666;
      font-weight: normal;
      position: absolute;
      top: 80px;
      left: 50%;
      transform: translateX(-50%);
    }
    h1 {
      font-size: 20px;
      color: #333;
      font-weight: normal;
      position: absolute;
      top: 40px;
      left: 50%;
      transform: translateX(-50%);
    }
    h2 {
      width: 129px;
      height: 38px;
      line-height: 38px;
      background: #296d9b;
      border-radius: 1em;
      color: #fff;
      font-size: 18px;
      font-weight: normal;
    }
    p {
      min-width: 160px;
      margin: 5px 0;
      text-align: left;
      font-size: 14px;
      color: #333;
      text-align: right;
      position: relative;
      padding: 0 20px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      &::after {
        content: '';
        width: 8px;
        height: 8px;
        border-radius: 8px;
        background: #296d9b;
        position: absolute;
        top: 50%;
        margin-top: -4px;
      }
    }
    .desc {
      width: 210px;
      height: 195px;
      overflow-y: auto;
      position: absolute;
      padding-right: 10px;
      &.big {
        width: 410px;
        display: flex;
        flex-wrap: wrap;
      }
      &::-webkit-scrollbar {
        width: 6px;
        height: 6px;
      }

      /*定义滚动条轨道 内阴影+圆角*/
      &::-webkit-scrollbar-track {
        border-radius: 10px;
        background-color: #dce7ef;
      }

      /*定义滑块 内阴影+圆角*/
      &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        background-color: #9ebed3;
      }
    }
    .item {
      position: absolute;
      width: 100%;
      height: 100%;
      justify-content: center;
      align-items: center;
      .inner {
        width: 700px;
        height: 470px;
        position: relative;
        .info {
          position: absolute;
          &:nth-child(1) {
            left: 97px;
            top: 0;
            .desc {
              top: -40px;
              left: -280px;
              &.big {
                left: -480px;
              }
            }
          }
          &:nth-child(2) {
            right: 97px;
            top: 0;
            .desc {
              top: -40px;
              left: 210px;
            }
          }
          &:nth-child(3) {
            left: 0;
            top: 210px;
            .desc {
              top: 40px;
              left: -183px;
              &.big {
                left: -383px;
              }
            }
          }
          &:nth-child(4) {
            right: 0;
            top: 210px;
            .desc {
              top: 40px;
              left: 113px;
            }
          }
          &:nth-child(5) {
            left: 97px;
            bottom: 0;
            .desc {
              width: 210px;
              height: 160px;
              top: 40px;
              left: 0px;
            }
          }
          &:nth-child(6) {
            right: 97px;
            bottom: 0;
            .desc {
              width: 210px;
              height: 160px;
              top: 40px;
              left: 0px;
            }
          }
        }
        .info1,
        .info3 {
          p {
            text-align: right;
            &::after {
              right: 0;
            }
          }
        }
        .info2,
        .info4,
        .info5,
        .info6 {
          p {
            text-align: left;
            &::after {
              left: 0;
            }
          }
        }
      }
    }
  }
}

@media screen and (max-device-width: 1440px) {
  .userPart {
    .part {
      background-size: 300px 300px !important;
      .item {
        .inner {
          width: 520px;
          height: 400px;

          h2 {
            width: 80px;
            height: 30px;
            line-height: 30px;
            font-size: 14px;
          }
          .info {
            &.info1 {
              .desc {
                left: -260px;
              }
            }
            &.info3 {
              .desc {
                height: 108px;
                left: -163px;
              }
            }
            &.info2 {
              .desc {
                left: 125px;
              }
            }
            &.info4 {
              .desc {
                height: 108px;
                left: 25px;
              }
            }
          }
        }
      }
    }
  }
}
</style>
